
import { Column, Table, PrimaryKey, Default } from 'sequelize-typescript';
import { BaseModel } from '@/model'
import { DataTypes } from "sequelize";
import { getUuidString } from "@/utils/uuid";

@Table
export class Indicator extends BaseModel {
  @Default(() => getUuidString())
  @Column({ type: DataTypes.STRING, allowNull: false, comment: '监测点Id' })
  declare id: string;

  @PrimaryKey
  @Column({ type: DataTypes.STRING, allowNull: false, comment: "监测点code" })
  indicatorCode: string;

  @Column({ type: DataTypes.STRING, allowNull: false, comment: "名称" })
  indicatorName: string;

  @Column({ type: DataTypes.STRING, allowNull: false, comment: "描述" })
  indicatorDesc: string;

  @Column({ type: DataTypes.INTEGER, allowNull: false, comment: "数据来源" })
  sourceType: number;

  @Column({ type: DataTypes.INTEGER, allowNull: false, comment: "时间类型" })
  dataTimeType: number;

  @Column({ type: DataTypes.INTEGER, allowNull: false, comment: "数据类型" })
  dataType: number;

  @Column({ type: DataTypes.STRING, allowNull: false, comment: "计算公式" })
  formula: string;

  @Column({ type: DataTypes.STRING, comment: "采集标签" })
  gatherCode: string;

  @Column({ type: DataTypes.STRING, comment: "父级id" })
  parentId: string;

  @Column({ type: DataTypes.STRING, comment: "父级code" })
  parentIndicatorCode: string;

  @Column({ type: DataTypes.INTEGER, comment: "计算类型" })
  dataCalcType: number;

  @Column({ type: DataTypes.INTEGER, comment: "数据库源" })
  dbSource: number;

  @Column({ type: DataTypes.INTEGER, comment: "小数位" })
  digit: number;

  @Column({ type: DataTypes.NUMBER, comment: "上限值" })
  maxVal: number;

  @Column({ type: DataTypes.NUMBER, comment: "下限值" })
  minVal: number;

  @Column({ type: DataTypes.INTEGER, comment: "合计类型" })
  mergeType: number;

  @Column({ type: DataTypes.STRING, comment: "是否为空" })
  isNull: string;

  @Column({ type: DataTypes.STRING, comment: "是否为0" })
  isZero: string;

  @Column({ type: DataTypes.INTEGER, comment: "排序" })
  sortId: number;

  @Column({ type: DataTypes.STRING, comment: "默认单位" })
  unit: string;
}
